package com.qf.rabbitMQ.controller;

import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author 郗昊天
 * @version 1.0
 * @package com.qf.rabbitMQ.controller
 * @date 2022/10/15 10:52
 */
@RestController
public class MqController {

    @Autowired
    private RabbitTemplate rabbitTemplate;

    @PostMapping("/queue")
    public String sendMsg(String msg){
        rabbitTemplate.convertAndSend("", "xht", msg);
        return "successful";
    }
}
